package io.renren.modules.substation.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.substation.entity.TBaseLoginLogEntity;
import io.renren.modules.substation.service.TBaseLoginLogService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 系统登录日志
 *
 * @author yzx
 * @email sunlightcs@gmail.com
 * @date 2020-09-02 15:49:38
 */
@RestController
@RequestMapping("substation/tbaseloginlog")
public class TBaseLoginLogController {
    @Autowired
    private TBaseLoginLogService tBaseLoginLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("substation:tbaseloginlog:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tBaseLoginLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{logId}")
    @RequiresPermissions("substation:tbaseloginlog:info")
    public R info(@PathVariable("logId") Long logId){
		TBaseLoginLogEntity tBaseLoginLog = tBaseLoginLogService.getById(logId);

        return R.ok().put("tBaseLoginLog", tBaseLoginLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("substation:tbaseloginlog:save")
    public R save(@RequestBody TBaseLoginLogEntity tBaseLoginLog){
		tBaseLoginLogService.save(tBaseLoginLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("substation:tbaseloginlog:update")
    public R update(@RequestBody TBaseLoginLogEntity tBaseLoginLog){
		tBaseLoginLogService.updateById(tBaseLoginLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("substation:tbaseloginlog:delete")
    public R delete(@RequestBody Long[] logIds){
		tBaseLoginLogService.removeByIds(Arrays.asList(logIds));

        return R.ok();
    }

}
